<?php
namespace app\api\validate;

class Index extends Base
{
    protected $rule =   [
        'name'          => 'require|max:25',
        'age'           => 'number|between:1,120',
        'email'         => 'email',
        
        # 分页
        'page'          => 'require|egt:0',
        'pagesize'      => 'require|between:1,100',
        
        # 短信
        'accountsid'    => 'require',
        'token'         => 'require',
        'appId'         => 'require',
        'templateId'    => 'require',
    ];
    
    protected $message  =   [
        'name.require'  => '名称必须',
        'name.max'      => '名称最多不能超过25个字符',
        'age.number'    => '年龄必须是数字',
        'age.between'   => '年龄只能在1-120之间',
        'email'         => '邮箱格式错误',
        
        # 分页
        'page.require'  => '分页参数page必须',
        'page.egt'      => '分页参数page必须大于0',
        
        'pagesize.require'  => '分页参数pagesize必须',
        //'pagesize.between'  => '分页参数pagesize必须大于0小于100',
        
        # 短信
        'accountsid'    => '短信账号必须',
        'token'         => '短信令牌必须',
        'appId'         => 'Appid必须',
        'templateId'    => '模板ID必须',
    ];
    
    protected $scene =  [
        # 短信
        'note'          => ['accountsid', 'token', 'appId', 'templateId'],
        
        # 分页场景
        'page'          => ['page', 'pagesize'],
    ];
    
}
